import Router from '@koa/router';
import AuthController from './controllers/auth';
import UserController from './controllers/user';

const unprotectedRouter = new Router();

// auth相关路由
unprotectedRouter.post('/auth/login', AuthController.login);
unprotectedRouter.post('/auth/register', AuthController.register);

// user相关路由
const protectedRouter = new Router();
protectedRouter.get('/user', UserController.userList);
protectedRouter.post('/user', UserController.userAdd);
protectedRouter.get('/user/:id', UserController.userDetail);
protectedRouter.put('/user/:id', UserController.userUpdate);
protectedRouter.delete('/user/:id', UserController.userDelete);

export { unprotectedRouter, protectedRouter }